package com.youlai.boot.system.converter;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.boot.common.model.Option;
import com.youlai.boot.system.model.entity.Plate;
import com.youlai.boot.system.model.form.PlateForm;
import com.youlai.boot.system.model.vo.PlatePageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 角色对象转换器
 *
 * @author haoxr
 * @since 2022/5/29
 */
@Mapper(componentModel = "spring")
public interface PlateConverter {
    Page<PlatePageVO> toPageVo(Page<Plate> page);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "name")
    })
    Option<Long> toOption(Plate plate);

    List<Option<Long>> toOptions(List<Plate> plates);

    Plate toEntity(PlateForm plateForm);

    PlateForm toForm(Plate entity);
}
